package com.vteba.security.spi;

import java.util.List;

import org.springframework.security.core.GrantedAuthority;

import com.vteba.security.filter.DefaultUserAuthenticationToken;
import com.vteba.security.user.IUserDetails;

public interface UserDetailsService extends org.springframework.security.core.userdetails.UserDetailsService {
	
	/**
	 * 根据用户名和机构代码加载用户
	 * @param username 用户名
	 * @param token 用户认证令牌
	 * @return 用户详情
	 */
	public IUserDetails loadUser(String username, DefaultUserAuthenticationToken token);
	
	/**
	 * 构建用户授权的权限
	 * @param user 认证通过的用户
	 * @return 该用户的授权权限
	 */
	public List<GrantedAuthority> buildGranted(IUserDetails user);
}
